import request from '@/router/axios';

// 查询砍价活动商品对象列表
export function listPromotiongoods(query) {
  return request({
    url: '/promotion/promotiongoods/list',
    method: 'get',
    params: query,
  });
}

// 查询砍价活动商品对象详细
export function getPromotiongoods(promotionId, params) {
  return request({
    url: `/promotion/manager/promotion/${promotionId}/goods`,
    method: 'get',
    params: params,
  });
}

// 新增砍价活动商品对象
export function addPromotiongoods(data) {
  return request({
    url: '/promotion/promotiongoods',
    method: 'post',
    data: data,
  });
}

// 修改砍价活动商品对象
export function updatePromotiongoods(data) {
  return request({
    url: '/promotion/promotiongoods',
    method: 'put',
    data: data,
  });
}

// 删除砍价活动商品对象
export function delPromotiongoods(id) {
  return request({
    url: '/promotion/promotiongoods/' + id,
    method: 'delete',
  });
}

// 积分商品列表
export function getPointsGoodsList(query) {
  return request({
    url: '/promotion/manager/promotion/pointsGoods',
    method: 'get',
    params: query,
  });
}

// 积分商品详情
export function getPointsGoodsById(id) {
  return request({
    url: `/promotion/manager/promotion/pointsGoods/${id}`,
    method: 'get',
  });
}

// 添加积分商品
export function addPointsGoods(data) {
  return request({
    url: '/promotion/manager/promotion/pointsGoods',
    method: 'post',
    data: data,
  });
}

// 修改积分商品状态
export function editPointsGoodsStatus(id, status) {
  return request({
    url: `/promotion/manager/promotion/pointsGoods/status/${id}/${status}`,
    method: 'put',
  });
}

// 修改积分商品
export function updatePointsGoods(data) {
  return request({
    url: '/promotion/manager/promotion/pointsGoods',
    method: 'put',
    data: data,
  });
}

// 删除积分商品
export function deletePointsGoodsStatus(id) {
  return request({
    url: `/promotion/manager/promotion/pointsGoods/${id}`,
    method: 'delete',
  });
}

// 积分商品分类列表
export function getPointsGoodsCategoryList(query) {
  return request({
    url: '/promotion/manager/promotion/pointsGoodsCategory',
    method: 'get',
    params: query,
  });
}

// 积分商品分类详情
export function getPointsGoodsCategoryById(id) {
  return request({
    url: `/promotion/manager/promotion/pointsGoodsCategory/${id}`,
    method: 'get',
  });
}

// 添加积分商品分类
export function addPointsGoodsCategory(data) {
  return request({
    url: '/promotion/manager/promotion/pointsGoodsCategory',
    method: 'post',
    data: data,
  });
}

// 修改积分商品分类
export function updatePointsGoodsCategory(data) {
  return request({
    url: '/promotion/manager/promotion/pointsGoodsCategory',
    method: 'put',
    data: data,
  });
}

// 删除积分商品分类
export function deletePointsGoodsCategoryById(id) {
  return request({
    url: `/promotion/manager/promotion/pointsGoodsCategory/${id}`,
    method: 'delete',
  });
}
